﻿Imports System.Data.SqlClient

Public Class ThamSo
    Inherits DataProvider

    Public Function LayThamSo() As DTO.ThamSo
        Dim thamSo As New DTO.ThamSo
        Dim sql_query As String = "SELECT * from thamso"

        Dim reader = Me.GetData(sql_query)
        If (IsNothing(reader)) Then
            Return Nothing
        End If

        reader.Read()
        thamSo.ThoiGianBayToiThiru = reader.Item("ThoiGianBayToiThiru")
        thamSo.SL_SanBayTrungGianToiDa = reader.Item("SL_SanBayTrungGianToiDa")
        thamSo.ThoiGianNghiTaiSanBayTu = reader.Item("ThoiGianNghiTaiSanBayTu")
        thamSo.ThoiGianNghiTaiSanBayDen = reader.Item("ThoiGianNghiTaiSanBayDen")
        Me.cnn.Close()
        Return (thamSo)
    End Function

    Public Function LuuThamSo(ByVal dto_thamSo As DTO.ThamSo) As Integer
        Dim sql_query As String = "update thamso set ThoiGianBayToiThiru=""" + dto_thamSo.ThoiGianBayToiThiru.ToString + """, SL_SanBayTrungGianToiDa=""" + dto_thamSo.SL_SanBayTrungGianToiDa.ToString + """,ThoiGianNghiTaiSanBayTu=""" + dto_thamSo.ThoiGianNghiTaiSanBayTu.ToString + """,ThoiGianNghiTaiSanBayDen=""" + dto_thamSo.ThoiGianNghiTaiSanBayDen.ToString + """"
        Return Me.SaveData(sql_query)
    End Function


End Class
